Skip to main content

For Each Of

AutomatR.DefaultActivities.Loop.ForEachOf<T>

The "For Each Of" activity in AutomatR is designed to iterate over a collection of items, performing a set of actions for each item in the collection. This activity simplifies the process of iterating through a list, array, or any enumerable type, making it easier to handle repetitive tasks in your workflows.

Properties

NameDescription
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variable or argument containing the desired display name.
ValuesSpecifies the collection of items to iterate over. It represents the enumerable type containing the items for iteration. Variables or expressions of type IEnumerable<T>.

How to use:

  1. Drag and drop the "For Each Of" activity onto the workflow.
  2. Configure the properties by specifying the collection of items (Values) and defining the actions to perform for each item (Body).
  3. Execute the workflow, and the specified actions will be performed for each item in the collection.

Example: Consider an example where the "For Each Of" activity is used to iterate through a list of strings and print each string to the console:

For Each Of:
Values: myList
Body:
WriteLine:
Text: currentItem

In this example, the activity iterates through the list named "myList," and for each string item, it executes the "WriteLine" activity to print the item to the console.